package awk.etl.dataset;

import awk.etl.model.DataSetBean;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 测试数据集
 */
public class DataSetExecuteMock {


    public static List<Map<String, Object>>[] datas = new List[]{dataSet1(), dataSet2(), dataSet3(), dataSet4(), dataSet5()};

    public static DataSetBean dataSet(String dataSetId) {
        return DataSetBean.builder().dataSetId(dataSetId).scripts("").params(new HashMap<>())
                .mocked(false).cached(false).build();
    }

    public static List<Map<String, Object>> dataSet1() {
        List<Map<String, Object>> dataSet1 = new ArrayList<>();
        for (int i = 0; i < 6; i++) {
            Map<String, Object> map = new HashMap<>();
            map.put("name", i + "xx" + i * i);
            map.put("age", 2 * i + 1);
            dataSet1.add(map);
        }
        return dataSet1;
    }

    public static List<Map<String, Object>> dataSet2() {
        List<Map<String, Object>> dataSet1 = new ArrayList<>();
        for (int i = 0; i < 6; i++) {
            Map<String, Object> map = new HashMap<>();
            map.put("appId", i * i + 2 * i);
            map.put("tag", "describe");
            dataSet1.add(map);
        }
        return dataSet1;
    }

    public static List<Map<String, Object>> dataSet3() {
        List<Map<String, Object>> dataSet1 = new ArrayList<>();
        for (int i = 0; i < 6; i++) {
            Map<String, Object> map = new HashMap<>();
            map.put("dataSourceId", i * i + 5 * i - 1);
            map.put("dataSourceName", "mysql");
            dataSet1.add(map);
        }
        return dataSet1;
    }

    public static List<Map<String, Object>> dataSet4() {
        List<Map<String, Object>> dataSet1 = new ArrayList<>();
        for (int i = 0; i < 6; i++) {
            Map<String, Object> map = new HashMap<>();
            map.put("iotDb", i * i * i + 2 * i);
            map.put("iotNum", "describe");
            dataSet1.add(map);
        }
        return dataSet1;
    }

    public static List<Map<String, Object>> dataSet5() {
        List<Map<String, Object>> dataSet1 = new ArrayList<>();
        for (int i = 0; i < 6; i++) {
            Map<String, Object> map = new HashMap<>();
            map.put("goodId", i ^ 4 + 8 * i ^ 2 + 3);
            map.put("goodName", "chicken");
            dataSet1.add(map);
        }
        return dataSet1;
    }

}
